home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Resources / Online / Term / Extras / Source / gtlayout-source.lha / LTP_MoveToWindow.c < prev    next >
C/C++ Source or Header  |  1996-03-18  |  777b  |  42 lines

  1. /*
  2. **    GadTools layout toolkit
  3. **
  4. **    Copyright © 1993-1996 by Olaf `Olsen' Barthel
  5. **        Freely distributable.
  6. **
  7. **    :ts=4
  8. */
  9.  
  10. #ifndef _GTLAYOUT_GLOBAL_H
  11. #include "gtlayout_global.h"
  12. #endif
  13.  
  14. VOID
  15. LTP_MoveToWindow(LayoutHandle *handle)
  16. {
  17.     if(V39)
  18.     {
  19.         WORD left,top,width,height;
  20.  
  21.         LTP_GetDisplayClip(handle->Screen,&left,&top,&width,&height);
  22.  
  23.         if(handle->Window->Width < width)
  24.             left = (width - handle->Window->Width) / 2;
  25.         else
  26.             left = 0;
  27.  
  28.         if(handle->Window->Height < height)
  29.             top = (height - handle->Window->Height) / 2;
  30.         else
  31.             top = 0;
  32.  
  33.         if((left = handle->Window->LeftEdge - left) < 0)
  34.             left = 0;
  35.  
  36.         if((top = handle->Window->TopEdge - top) < 0)
  37.             top = 0;
  38.  
  39.         ScreenPosition(handle->Screen,SPOS_MAKEVISIBLE,left,top,left + width - 1,top + height - 1);
  40.     }
  41. }
  42.